param(
	[string]$gatWebUrl = "$(Read-Host 'Enter the GATs site Url')",
	[string]$caWebUrl =  "$(Read-Host 'Enter the CAs site Url')"
)	

Write-Host "`n===================`n# Deleting GATs #`n===================" -ForegroundColor Yellow

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

#Load the site
$web = Get-SPWeb -identity $gatWebUrl
Write-Host $gatWebUrl " Site loaded" -ForegroundColor Green

#Load the document library
$list = $web.Lists["GATs"]
Write-Host $list.Url "Document library loaded" -ForegroundColor Green

$listItems = $list.Items;
$count = $listItems.Count - 1

for($intIndex = $count; $intIndex -gt -1; $intIndex--)
{
	#"Deleting: " + $intIndex
	$listItems.Delete($intIndex);
}

Write-Host "Delete Completed. " $listItems.Count " number of items is deleted" -ForegroundColor Green


Write-Host "`n===================`n# Deleting Credit Applications #`n===================" -ForegroundColor Yellow
#Load the site
$web = Get-SPWeb -identity $caWebUrl
Write-Host $caWebUrl " loaded" -ForegroundColor Green

#Load the document library
$list = $web.Lists["CreditApplications"]
Write-Host $list.Url "Document library loaded" -ForegroundColor Green

$listItems = $list.Items;
$count = $listItems.Count - 1

for($intIndex = $count; $intIndex -gt -1; $intIndex--)
{
	#"Deleting: " + $intIndex
	$listItems.Delete($intIndex);
}


Write-Host "Delete Completed" $listItems.Count "number of items is deleted" -ForegroundColor Green


Remove-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue